package com.laobiao.file_netty_lib.netty;

import com.laobiao.file_netty_lib.packet.BasePacket;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 编码器
 * @author 38079
 *
 */
public class PacketToBytesEncoder extends MessageToByteEncoder<BasePacket>{

	@Override
	protected void encode(ChannelHandlerContext ctx, BasePacket msg, ByteBuf out) throws Exception {
		
		out.writeBytes(msg.getPacketBytes());
	}

}
